package com.example.animation_01;

import android.app.ActivityOptions;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class TranslationFromActivity extends AppCompatActivity {
    private Button mbutton1;
    private Button mbutton2;
    private Button mbutton3;
    private Button mbutton4;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_from);
        mbutton1=findViewById(R.id.button1);
        mbutton2=findViewById(R.id.button2);
        mbutton3=findViewById(R.id.button3);
        mbutton4=findViewById(R.id.button4);
        addListener(mbutton1,1);
        addListener(mbutton2,2);
        addListener(mbutton3,3);
        addListener(mbutton4,4);
    }
    private void addListener(Button button,int flag){
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(TranslationFromActivity.this, TranslationToActivity.class);
                intent.putExtra("flag",flag);
                startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(TranslationFromActivity.this).toBundle());

            }
        });

    }
}
